﻿#include "paraitem.h"


ParaItem::ParaItem(QObject *parent) : QObject(parent)
{
    clean();
}

ParaItem::~ParaItem()
{
    paraName.clear();
    selList.clear();
    unitStr.clear();
    valueStr.clear();
}

ParaItem::ParaItem(const ParaItem & item) : QObject()
{
    copyData(item);
}

ParaItem & ParaItem::operator=(const ParaItem & item)
{
    copyData(item);
    return *this;
}

void ParaItem::clean()
{
    mcenSel       = 0;
    paraType      = 0;
    paraTypeSort  = 0;
    indexInPara   = -1;
    bitInWord     = 0;
    readonly      = 0;
    valueType     = 0;
    paraName      = "";
    value         = 0;
    minVal        = 0;
    maxVal        = 0;
    defValue      = 0;
    afterPoint    = 0;
    unitStr       = "";
    valueStr      = "";
    selList       = "";
    selIdx        = -1;
    defIdx        = -1;
    showPriority  = 0;
    authority     = 0;
}

void ParaItem::copyData(const ParaItem & item)
{
    if (this != &item)
    {
        this->mcenSel       = item.mcenSel;
        this->paraType      = item.paraType;
        this->paraTypeSort  = item.paraTypeSort;
        this->indexInPara   = item.indexInPara;
        this->bitInWord     = item.bitInWord;
        this->readonly      = item.readonly;
        this->valueType     = item.valueType;
        this->paraName      = item.paraName;
        this->value         = item.value;
        this->minVal        = item.minVal;
        this->maxVal        = item.maxVal;
        this->defValue      = item.defValue;
        this->afterPoint    = item.afterPoint;
        this->unitStr       = item.unitStr;
        this->valueStr      = item.valueStr;
        this->selList       = item.selList;
        this->selIdx        = item.selIdx;
        this->defIdx        = item.defIdx;
        this->showPriority  = item.showPriority;
        this->authority     = item.authority;
    }
}
